package cn.wolfcode.luowowo.article.service.impl;

import cn.wolfcode.luowowo.article.domain.QuestionTag;
import cn.wolfcode.luowowo.article.mapper.QuestionTagMapper;
import cn.wolfcode.luowowo.article.service.IQuestionTagService;
import com.alibaba.dubbo.config.annotation.Service;
import org.springframework.beans.factory.annotation.Autowired;

import java.util.List;

/**
 * Created by Administrator on 2019/7/19.
 */
@Service
public class QuestionTagServiceImpl implements IQuestionTagService{
    @Autowired
    private QuestionTagMapper questionTagMapper;
    @Override
    public void delete(Long id) {
        questionTagMapper.deleteByPrimaryKey(id);
    }

    @Override
    public void saveOrupdate(QuestionTag record) {
        if (record.getId()==null){
            questionTagMapper.insert(record);
        }else {
            questionTagMapper.updateByPrimaryKey(record);
        }
    }

    @Override
    public QuestionTag get(Long id) {
        return questionTagMapper.selectByPrimaryKey(id);
    }

    @Override
    public List<QuestionTag> listAll() {
        return questionTagMapper.selectAll();
    }
}
